package com.kx.center.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.kx.center.common.JsonDateSerializer;

import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Map;

/**
 * @description 门店信息表
 * @version 1.0
 * @author Scott 
 * @date 2015年12月18日 上午10:21:58
 */
@JsonIgnoreProperties ({
	"latitude","longitude","province","city","area"
})
public class StoreInfo {

	private int id;
	private String storeName;
	private int storeType;
	private String shippingDate ;
	private String latitude ;
	private String longitude ;
	private int areaRange;
	private String province ;
	private String city ;
	private String area;
	private String address;
	private Time shippingStartTime;
	private Time shippingEndTime;
	private String shopOwner;
	private String mobile;
	private int companyId;
	private int brandId;
	private String showImg1;
	private String showImg2;
	private String storeDesc;
	private int freightType;
	private double freightFee;
	private double startingPrice;
	private double freightLimit;
	private int isBookable;
	private int invoice;
	private double invoiceMinAmount;
	private String invoiceDescription;
	private int operatorId;
	private int status;
	private Timestamp createTime;
	private Timestamp updateTime;
	
	//添加推送类型和支付类型
	private int pushType;
	private int paymentType;

	public int getAreaRange() {
		return areaRange;
	}

	public void setAreaRange(int areaRange) {
		this.areaRange = areaRange;
	}

	public int getPushType() {
		return pushType;
	}

	public void setPushType(int pushType) {
		this.pushType = pushType;
	}

	public int getPaymentType() {
		return paymentType;
	}

	public void setPaymentType(int paymentType) {
		this.paymentType = paymentType;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getStoreName() {
		return storeName;
	}

	public void setStoreName(String storeName) {
		this.storeName = storeName;
	}

	public int getStoreType() {
		return storeType;
	}

	public void setStoreType(int storeType) {
		this.storeType = storeType;
	}

	public String getShippingDate() {
		return shippingDate;
	}

	public void setShippingDate(String shippingDate) {
		this.shippingDate = shippingDate;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public int getRange() {
		return areaRange;
	}

	public void setRange(int areaRange) {
		this.areaRange = areaRange;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Time getShippingStartTime() {
		return shippingStartTime;
	}

	public void setShippingStartTime(Time shippingStartTime) {
		this.shippingStartTime = shippingStartTime;
	}

	public Time getShippingEndTime() {
		return shippingEndTime;
	}

	public void setShippingEndTime(Time shippingEndTime) {
		this.shippingEndTime = shippingEndTime;
	}

	public String getShopOwner() {
		return shopOwner;
	}

	public void setShopOwner(String shopOwner) {
		this.shopOwner = shopOwner;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public int getCompanyId() {
		return companyId;
	}

	public void setCompanyId(int companyId) {
		this.companyId = companyId;
	}

	public int getBrandId() {
		return brandId;
	}

	public void setBrandId(int brandId) {
		this.brandId = brandId;
	}

	public String getShowImg1() {
		return showImg1;
	}

	public void setShowImg1(String showImg1) {
		this.showImg1 = showImg1;
	}

	public String getShowImg2() {
		return showImg2;
	}

	public void setShowImg2(String showImg2) {
		this.showImg2 = showImg2;
	}

	public String getStoreDesc() {
		return storeDesc;
	}

	public void setStoreDesc(String storeDesc) {
		this.storeDesc = storeDesc;
	}

	public int getFreightType() {
		return freightType;
	}

	public void setFreightType(int freightType) {
		this.freightType = freightType;
	}

	public double getFreightFee() {
		return freightFee;
	}

	public void setFreightFee(double freightFee) {
		this.freightFee = freightFee;
	}

	public double getStartingPrice() {
		return startingPrice;
	}

	public void setStartingPrice(double startingPrice) {
		this.startingPrice = startingPrice;
	}

	public double getFreightLimit() {
		return freightLimit;
	}

	public void setFreightLimit(double freightLimit) {
		this.freightLimit = freightLimit;
	}

	public int getIsBookable() {
		return isBookable;
	}

	public void setIsBookable(int isBookable) {
		this.isBookable = isBookable;
	}

	public int getInvoice() {
		return invoice;
	}

	public void setInvoice(int invoice) {
		this.invoice = invoice;
	}

	public double getInvoiceMinAmount() {
		return invoiceMinAmount;
	}

	public void setInvoiceMinAmount(double invoiceMinAmount) {
		this.invoiceMinAmount = invoiceMinAmount;
	}

	public String getInvoiceDescription() {
		return invoiceDescription;
	}

	public void setInvoiceDescription(String invoiceDescription) {
		this.invoiceDescription = invoiceDescription;
	}

	public int getOperatorId() {
		return operatorId;
	}

	public void setOperatorId(int operatorId) {
		this.operatorId = operatorId;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public Timestamp getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Timestamp updateTime) {
		this.updateTime = updateTime;
	}

	public boolean initStoreBean(Map<String,String> paraMap){

		if(paraMap.get("store_name") == null){
			return false;
		}
		this.setStoreName(paraMap.get("store_name"));

		try{
			if(paraMap.get("shipping_date") != null){
				this.setShippingDate(paraMap.get("shipping_date"));
			}
			if(paraMap.get("shipping_start_time") != null){

				SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
				java.util.Date date  = null;
				date = sdf.parse(paraMap.get("shipping_start_time"));
				this.setShippingStartTime(new Time(date.getTime()));
			}

			if(paraMap.get("shipping_end_time") != null){

				SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
				java.util.Date date  = null;
				date = sdf.parse(paraMap.get("shipping_end_time"));
				this.setShippingEndTime(new Time(date.getTime()));
			}

			if(paraMap.get("latitude") != null){
				this.setLatitude(paraMap.get("latitude"));
			}

			if(paraMap.get("longitude") != null){
				this.setLongitude(paraMap.get("longitude"));
			}

			if(paraMap.get("range") != null){
				this.setRange(Integer.valueOf(paraMap.get("range")));
			}

			if(paraMap.get("province") != null){
				this.setProvince(paraMap.get("province"));
			}

			if(paraMap.get("city") != null){
				this.setCity(paraMap.get("city"));
			}

			if(paraMap.get("area") != null){
				this.setArea(paraMap.get("area"));
			}

			if(paraMap.get("address") != null){
				this.setAddress(paraMap.get("address"));
			}

			if(paraMap.get("shop_owner") != null){
				this.setShopOwner(paraMap.get("shop_owner"));
			}

			if(paraMap.get("mobile") != null){
				this.setMobile(paraMap.get("mobile"));
			}

			if(paraMap.get("show_img1") != null){
				this.setShowImg1(paraMap.get("show_img1"));
			}

			if(paraMap.get("show_img2") != null){
				this.setShowImg2(paraMap.get("show_img2"));
			}

			if(paraMap.get("store_desc") != null){
				this.setStoreDesc(paraMap.get("store_desc"));
			}

			if(paraMap.get("freight_type") != null){
				this.setFreightType(Integer.valueOf(paraMap.get("freight_type")));
			}

			if(paraMap.get("freight_fee") != null){
				this.setFreightFee(Double.valueOf(paraMap.get("freight_fee")));
			}

			if(paraMap.get("starting_price") != null){
				this.setStartingPrice(Double.valueOf(paraMap.get("starting_price")));
			}

			if(paraMap.get("freight_limit") != null){
				this.setFreightLimit(Double.valueOf(paraMap.get("freight_limit")));
			}

			if(paraMap.get("is_bookable") != null){
				this.setIsBookable(Integer.valueOf(paraMap.get("is_bookable")));
			}

			if(paraMap.get("invoice") != null){
				this.setInvoice(Integer.valueOf(paraMap.get("invoice")));
			}

			if(paraMap.get("invoice_min_amount") != null){
				this.setInvoiceMinAmount(Double.valueOf(paraMap.get("invoice_min_amount")));
			}

			if(paraMap.get("invoice_description") != null){
				this.setInvoiceDescription(paraMap.get("invoice_description"));
			}
			
			if(paraMap.get("push_type") != null){
				this.setPushType(Integer.valueOf(paraMap.get("push_type")));
			}

			if(paraMap.get("payment_type") != null){
				this.setPaymentType(Integer.valueOf(paraMap.get("payment_type")));
			}
			
		}catch (Exception e){
			return false;
		}

		return true;
	}
}
